/// 详情页面参数
class DetailArguments {
  final String id;
  final String title;
  final String? subtitle;
  final String? imageUrl;
  final String? description;
  final Map<String, dynamic>? extraData;

  DetailArguments({
    required this.id,
    required this.title,
    this.subtitle,
    this.imageUrl,
    this.description,
    this.extraData,
  });

  /// 从Map创建
  factory DetailArguments.fromMap(Map<String, dynamic> map) {
    return DetailArguments(
      id: map['id'] ?? '',
      title: map['title'] ?? '',
      subtitle: map['subtitle'],
      imageUrl: map['imageUrl'],
      description: map['description'],
      extraData: map['extraData'],
    );
  }

  /// 转换为Map
  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'title': title,
      'subtitle': subtitle,
      'imageUrl': imageUrl,
      'description': description,
      'extraData': extraData,
    };
  }
}
